#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'dong'

from flask import Flask, request, jsonify, render_template
from sendMsg import explainPhoneNumber

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')

@app.route('/getNumber')
def getNumber():
    getPhoneNumber = request.args.get('getPhoneNumber', 0)
    msgTemplate = request.args.get('msgTemplate', 0)
    return jsonify(resultMsg = explainPhoneNumber(getPhoneNumber, msgTemplate))


@app.errorhandler(404)
def not_found(e):
    return render_template('404.html')

if __name__ == '__main__':
    app.run(
        host="0.0.0.0",
        port=int(8010),
        debug=True
    )
